# -*- coding:utf-8 -*-
'''
@author: xiaoming
@contact: lishihui0129@163.com
@time: 2017/6/29 15:40
@desc:
'''
import re
import os
from myUtil import mobilphonePattern,flagSplitPattern
from mysqlHelper import connectDB,close,insertSql


def mobelphoneNumberExtract(string):
    '''
    :param string: 待提取对象
    :return:提取结果
    '''
    # print "------------------"
    # print string
    # print "------------------"
    string=string.strip().strip('-').strip('-')

    if string.isdigit() and (not string.startswith('1') or string.startswith('11')):
        return []
    else:
        res=re.findall(mobilphonePattern,string)

        res=list(set(res))
        temp=[]
        for item in res:
            tmp=item.replace('-','')
            if tmp.startswith('11') or tmp.startswith('12') or tmp.startswith('19') or tmp.startswith('10'):
                continue
            if len(tmp) ==11:
                temp.append(item)
            else:
                continue
        return temp
